package hhq.demo.listener;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * 启动完成后，自动运行的无需配置
 */
@Component
public class MyAppRunner implements ApplicationRunner {

    @Value("${server.address}")
    String host;

    @Value("${server.port}")
    String port;

    @Value("${server.servlet.context-path}")
    String context_path;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        System.out.println("系统启动成功！ 点击运行: ");
        System.out.println("http://" + host + ":" + port + context_path + "/");
        System.out.println("http://localhost:" + port + context_path + "/");
    }
}
